MaNGOSWeb Installation Guide
Re-write Version 1, Seoulborn
January 23, 2008

~~~~~~~~~~~~
Table of contents:

	About this guide

	#1 - Requirements
	#2 - Check out the MaNGOSWeb source files
	#3 - Installation
	      3.a - Installation using the install.php
	      3.b - Manual Installation
	#4 - Configuring your MaNGOSWeb site
	      4.a Install SQL files
	      4.b Editing the config/config.xml
	#5 Web interface and Admin Panel
	#6 Setup News Forum to display on main page
	#7 - How to install Donation System
	#8 - How to update your MaNGOSWeb version
	
	Conclusion
		

~~~~~~~~~~~~

About this guide

This guide will help you set up the MaNGOSWeb CMS portal for a LAN. 
For the sake of clarity, it is re-written with the understanding that
you are running MaNGOS, Apache/MySQL/PHP, and MaNGOSWeb on the same 
machine using a windows operating system. Where possible, I will 
include linux-based instructions. I do not know anything about linux 
other than a brief experience with Ubuntu on a laptop. So any information 
I include was part of the original documentation and you should consult 
the MaNGOSWeb forum for details.

In addition to the above, I am writing this as I actually perform the 
steps I'm documenting. With luck, I'll have a functioning localhosted 
website by the time I'm done re-writing this. If it works out I'll do 
screen shots in a PDF. Pictures are worth a thousand words, right? And 
anything is better than notepad and all of it's progeny.

Disclaimer - I'm writing this document a bit more informal than if I 
was writing for my company. Mainly, because I want to be informative 
as well as instructional. So, if this is too wordy for you, just follow 
the comments in the config/config.xml when you edit it. It's straight and to
the point. Just refer to the 5.a to prep the database for your portal.

The MaNGOSWeb forum can be found at: 
http://mangosweb.retro-hosting.co.uk/

Additional information can be found at the MaNGOS Project forum at: 
http://www.mangosproject.org/forum/index.php?showtopic=16326

~~~~~~~~~~~~

#1 - Requirements
     Apache with Mysql & PhP support
		- Apache v2.2.x
		- MySQL 5.0.x
		- Php version 5.x
		  - GD compiled into Php 
                    (In windows, enable GD exetension in php.ini file).

You can try installing each of these components individually, or you 
can try one of the pre-packaged flavors out there. These pre-packages 
configured so that everything works "out-of-the-box", with a few tweaks 
here and there to have you up and running.

Examples:
	WAMP - Windows platform
	LAMP - Linux platform 
	XAMPP - Comes in Windows and Linux flavors and supports Perl
	
Only basic support can be given to you regarding installation and setting 
up your web server.  You will need to consult the respective creators of 
your webserver software.

~~~~~~~~~~~~

#2 - Check out the MaNGOSWeb source files

Installations requires that you check out the source files through SVN. 
I recommend using TortoiseSVN. It's fast free and easy to use and can 
be found as of this writing at http://tortoisesvn.tigris.org

Consult TortoiseSVN's website for use on other operating systems.
		
How to check out source files:
  a) Create a folder called MaNGOSWeb.
  b) Right-click the folder and click SVN Checkout..
  c) Enter http://tools.assembla.com/svn/mangosweb in the URL of Repository.
  d) Select HEAD revision and click OK.
  
Be patient, at the time I am writing this it is a 107MB download.

When the checkout process is complete you will have a file structure like so:

Root Folder (C:\Source\MaNGOSWeb)
 \components\(sub-content)
 \core\(sub-content)
 \flash\(sub-content)
 \images\(sub-content)
 \imap\(sub-content)
 \js\(sub-content)
 \lang\(sub-content)
 \sql\(sub-content)
 \templates\(sub-content)
 \config\(sub-content)
 \changelog.txt
 \donate.php
 \index.php
 \mangos.conf
 \notice.php
 \MaNGOSWeb_Installation_Guide.txt
 \realmlist.wtf
 \rss.php
 \show_picture.php
 \TODO List.txt
 \ToS.html
 
 You will want to keep this file structure intact when doing a manual installation.


~~~~~~~~~~~~

#3 - Installation

MaNGOSWeb installation comes in two flavors:
	3.a - Installation using the install.php
	3.b - Manual Installation

3.a - Installaton using install.php

As of this writing, install.php is broken and should not be used. If your 
download contains an install.php and this version of the Installation Guide 
then DO NOT USE IT.This will be re-implemented once the install.php has 
been re-written.

3.b - Manual Installation

To manually install MaNGOSWeb once your source files are downloaded, 
you will need to copy the MaNGOSWeb folder or the contents to your 
htdoc folder. I do not recommend  using your htdoc folder as your 
check out folder. Doing this could result in a broken website when 
it is time to update to a new version.

Example: 

I use WAMP as my webserver software and my MaNGOS folder is located at 
C:\Source\MaNGOSWeb\. Because I use WAMP as my webserver, my htdoc folder 
is called www and is located on my hard drive at c:\WAMP\www\. I copy the 
contents of my MaNGOSWeb folder to the root of c:\WAMP\www\. Doing this 
will cause the MaNGOS web page to be my default web page when I or my LAN 
users browse to http:\\localhost\

If you have configured your webserver for the internet, then your players 
can navigate to your website using http:\\your-domain-name\ 
or http:\\ip-address\subfolder\ (if you copied the MaNGOSWeb content to a subfolder).

In order for MaNGOSWeb to function properly you to enable write/edit/read 
permissions on the CORE folder once it is copied to your htdoc folder. 

To enable write/edit/read on the CORE and IMAGES folder on Linux: Chmod 
the following to 777.

 /core/cache/
 /core/cache/randimg/
 /core/cache/lang/
 /core/cache/rss/
 /core/cache/sites/
 /core/cache/modules/
 /core/cache/mangos_scripts
 /core/cache/wallp/
 /core/cache/screen/
 /core/logs/core_error_log.log
 /images/attachs/
 /images/avatars/
 /images/wallpapers/
 /images/screenshots/


To enable write/edit/read on the CORE folder on Windows: Remove the folder's 
read-only attribute.

~~~~~~~~~~~~

#4 - Configuring your MaNGOSWeb site

Yay!! Now for the fun and very very confusing part, at least it was for me. 
It's time to configure your MaNGOSWeb CMS portal to go online. This is really 
not a very hard process. The config/config.xml is commented pretty well, so this
guide just gives you a little more detail on the sections.

4.a Install SQL files

For a Full Installation from scratch use the full__installation.sql.
Also Create a database called "characters_temp"and run the "characters_temp.sql" on it

 1. In MySQL select the realmd database. Everything in this section is done
    using the realmd database. I assume that you are using the default MaNGOS 
    database setup. If you've named your realmd database something else 
    then select it.

 2. Depending on what interface you're using for MySQL, you will need to 
    restore from sql dump. I used the Community version of SQLyog because 
    it's free and the import from text in phpMyAdmin doesn't support large 
    file sizes.
 
 3. Go to SQL > Extra_Install ad restore the account_pass.sql.

 4. Select the account_extend table and look-up your account in the "account_id" 
    column. Your account ID is cross-referenced in the from the corresponding 
    account table. Looking for it in the account table first maybe easier since
    you can see the user names associated with the account ID.
 
 5. Locate the g_id column for your account_id in the account_extend table. Modify
    this to a 3 or a 4 to give yourself admin(3) or root admin(4) access to the 
    MaNGOSWeb.

!!!!! IMPORTANT STEPS !!!!!

 6. Select the realmlist table and locate the dbinfo column. This is the key 
    to nearly all the functionality of the website and provides MaNGOSWeb's 
    connection to the world database - mangos. The format for this column is:
    username;password;port;ip_address;world_Dbname;character_Dbname
 
 7. Modify the format with your database information. 
    Example: root;mangos;3306;127.0.0.1;mangos;characters

        MySQL username = root
              password = mangos (this should be whatever password you assigned root)
                  port = 3306
            ip_address = 127.0.0.1 (if you're doing a localhost connection, this works)
          world_Dbname = mangos
     characters_Dbname = characters

You should be ready to go on to edit the config/config.xml.

4.b Editing the config/config.xml

We're almost done! Isn't that great!! Let's continue.

 1. Open the config/config.xml, using notepad or your favorite text editor. I use
    notepad++ because it color codes and makes the text easier to read and 
    identify. Set the variable: $dev to equal FALSE. $dev = FALSE;

 2. Set the realmd array to match the information from step 7 - 4.a Installing 
    SQL files. If this information is not valid, MaNGOSWeb will fail to function.
    Boy-howdy, don't I know this one, ask me how :P

Follow the configuration variables to the end, setting the values according 
to your needs or unless otherwise prompted by the comments. Setting values to 
one or zero will flag that variable as on or off. I'm sure you know this but 
0 = off, 1 = on.

NOTE: 
   To change Default size that can be uploaded of Wallpapers and Screenshots go to:
   /templates/offlike/media/media.screen.php Ln=7, Col=46 
   Change 2 to whatever you want. Example: 2=200k, 4=400k, 10=1mb
        
   /templates/offlike/media/media.wallp.php   Ln=7, Col=46 
   Change 2 to whatever you want Example: 2=200k, 4=400k, 10=1mb

Once you're done, it's time to go online and set up the rest of MaNGOSWeb's interface.

~~~~~~~~~~~~

#5 Web interface and Admin Panel

Browse to your MaNGOSWeb page and accept the ToS. Login to the MaNGOSWeb using 
the administrator account you created in 4.a Installing SQL files.

Go to Context menu: > Admin Panel. Mousing can be a little tricky with the drop-down
menu. Hopefully the will fix this with future releases.

From the Admin Panel, you can set the variables for:
  - Users
  - Site Settings
  - Realms (here you can add existing Realms. This is not the same as creating new ones)
  - Reg Keys (these are registration keys mailed to users to validate their accounts)
  - Languages (here you can add or delete languages from the Choose Language: menu
  - Donate Admin (configure your site to accept donations and to give reward/items for
                  donations)
  - Backup Management (This one I'm not too sure about, I bet the programmer knows!)
  - Add News
  - Edit News
  - Configure Chat (I believe this is java or javascript based and might come in handy)

~~~~~~~~~~~~

#6 Setup News Forum to display on main page

The news forum is not set up on the site initially. You will probably want to set 
this up, since news posting does not work without it. 

To begin:

 1. Login with your level 4 account (root admin access)

 2. Go to Context menu: > Admin Panel, click Forum

 3. Create new category and leave the order at 1. (News would be a good suggestion for
    a category, and if you changed your config/config.xml to a differen number for this section
    that is the number you should use.)

 4. News will now appear at the top of the page, click it.
 
 5. Create a new Forum (topic?). You may want to give this a name that includes the name
    of your site. This will be in the RSS if you choose to publish this on the 
    internet.  Leave the order at one, unless you specified others in the config/config.xml.
    If you allow members to post new topics, then you may want to close this forum to
    the public.

    a) To close a forum, click the first icon - a page - a page next to the Topic.
       To open a closed forum, click the first icon again.

    b) To hide a topic from view without deleting it click the middle icon - a page 
       with a blue exclamation. To reveal a hidden forum, click the middle icon again.

    c) To post to a click the third icon - a page with a pencil. 
		  
 6. To post or edit a closed forum go to:
    Context menu: > Admin Panel > Add or Edit News

If you follow these steps exactly, and leave Default Component to frontpage, topics
you post here will appear on the main page. Very Blizzlike. And you can probaby see
why you don't want this section cluttered up with member comments :D.

~~~~~~~~~~~~

#7 - How to install DONATION SYSTEM

To auto grant access to your donation template:
Run 482_account_extended_auto_granting.sql or 482_account_extended_manual_grating.sql,
to grant acccess manually.

    a) Create a premier paypal account. (It's free)
	
    b) From the PayPal menu, go to Profile > Under selling Preferences > Instant Payment 
       Notification Preferences.
    c) Select Instant notification
    d) Enter the full path including your domain name to donation.php in the root of your
       MaNGOS directory. 
       Example: http://you-domain-or-ip/subdirectoryifyouhaveone/donation.php

Everyone likes a little pat on the back for their donations, unless they're good
samaritans like me...and just doing good deeds is satisfaction enough. If they're not
like me :P, then you may want to reward them for their donations

To create, edit, or send donation packs and items, go to:
Context menu: > Admin Panel> Donate Admin or see table `donation_template`in the
realmd database.

	
That should do it!

~~~~~~~~~~~~

#8 - How to update your MaNGOSWeb version

I'm so glad this is almost over!! I'm really tired :P


    1. Backup your config/config.xml and your realmd database.
	
    2. Right-click your MaNGOSWeb source folder and click SVN Update.
	
    3. Copy any changed files to the MaNGOSWeb web folder.
   
    4. Apply SQL updates from the source SQL folder

~~~~~~~~~~~~

Conclusion

Gosh that's it, we've reached the end of the internets.  No, not really, it's just
fun to say that. So is saying, "The internets is a series of tubes".

Seriously, after re-writing this readme, I realized there are HUGE chunks of missing
information that could and should be answered either in a MaNGOSWeb wiki or online
help file.

Even so, if you've configured you Webserver, MySQL (c'mon you had to have if your 
MaNGOS server is working) and PHP correctly. Then following this step-by-step will
Have the basics up and running for you.

I KNOW! Before I re-wrote this I tried to configure this thing and man!
Did I blow it up? You bet I did. I was about to go back to a simple one page something
or other.

So really, if I can do it, I certainly know you can.
    

Live Changelog:
http://tools.assembla.com/mangosweb/timeline
